#ifndef DATAINTEGRITY_H_
#define DATAINTEGRITY_H_

/************************************************************************************
*	Copyright Paxs Electronics 2012													*
*   All Rights Reserved																*
*   The Copyright symbol does not also indicate public availability or publication.	*
* 																					*
* 								PAXS ELECTRONICS									*
* 																					*
* - Driver:   			Data Integrity												*
* 																					*
* - Compiler:           Code Composer Studio (Licensed)								*
* - Supported devices:  All Stellaris Family Cortex-M3.								*
* - AppNote:																		*
*																					*
* 	Created by: 		Juan Francisco Gomez Ruiz									*
*   Date Created: 		20 - Apr - 2012												*
*   Contac				pacoduz@gmail.com											*
* 																					*
* 	Description: 		Functions to check Integrity Data. Like: CheckSum or CRC	*										*
*   Device supported and tested: - LM3S5749 - LM3S3748 -							*
* 																				2012*
*************************************************************************************

*************************************************************************************
* 	Revision History:
*
*   Date          CP#           Author
*   MM-DD-YY      XXXXX:1       Initials   Description of change
*   -----------   -----------   --------   ------------------------------------
*    04-20-12      	1.0             JFGR	Initial version. Support CheckSum

*************************************************************************************
* 	File/
*  
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
*  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
*  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
*  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,  
*  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
*  DEALINGS IN THE SOFTWARE.
* 
*/

/******************************************************************************
*							LOCAL MACRO DEFINITIONS
******************************************************************************/
	#define CHECKSUM_LIMIT		250
	#define UNSIGNED_CHAR		0
	#define UNSIGNED_SHORT		1
	#define CHECKSUM_FORMAT		UNSIGNED_SHORT
/******************************************************************************
*   Local Type Definitions
******************************************************************************/

/******************************************************************************
*   Local Function Declarations
******************************************************************************/

/******************************************************************************
*   Global Variable Definitions
******************************************************************************/

/******************************************************************************
*   Static Variable Definitions
******************************************************************************/

/******************************************************************************
*   Global and Static Function Definitions
******************************************************************************/
	#if CHECKSUM_FORMAT == UNSIGNED_CHAR
		unsigned char VfnCheckSum8(unsigned char * ValidationBuffer, unsigned char BufferSize);
		unsigned char  VfnDataPackageValidation8(unsigned char PackageCheckSum, unsigned char* ValidationPackage, unsigned char BufferSize);
	#endif
	#if CHECKSUM_FORMAT == UNSIGNED_SHORT
		unsigned short VfnCheckSum16(unsigned char * ValidationBuffer, unsigned char BufferSize);
		unsigned char  VfnDataPackageValidation16(unsigned short PackageCheckSum, unsigned char* ValidationPackage, unsigned char BufferSize);
	#endif
#endif /*DATAINTEGRITY_H_*/
